// PartDBReader.h: interface for the PartDBReader class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PARTDBREADER_H__D013EB56_6D51_40EE_A076_40ACA3EA180D__INCLUDED_)
#define AFX_PARTDBREADER_H__D013EB56_6D51_40EE_A076_40ACA3EA180D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "RegisterObject.h"
#include "partDBReaderInfo.h"
#include "FunctionObject.h"
#include "variable.h"

class ModelObject;

class PartDBReader : public RegisterObject<PartDBReader, PartDBReaderInfo> 
{
	DECLARE_DYNAMIC_EX(PartDBReader)
public:
	PartDBReader();
	virtual ~PartDBReader();

public:
	virtual FunctionObject* Reader(const _RecordsetPtr& rs) = 0;

	void AttachTo(ModelObject* pPart){
		ASSERT(pPart != NULL);
		m_pPart = pPart;
	}

protected:
	FunctionObject* CreateObject(const _RecordsetPtr& rs);

	ModelObject& GetPart(){
		ASSERT(m_pPart != NULL);
		return *m_pPart;
	}

	CString GetString(INT nIndex, const _RecordsetPtr& rs);
	Variable* GetVariable(INT nIndex, const _RecordsetPtr& rs);
private:
	ModelObject* m_pPart;
};

#endif // !defined(AFX_PARTDBREADER_H__D013EB56_6D51_40EE_A076_40ACA3EA180D__INCLUDED_)
